import request from '@/utils/request'

/**
 * @time    2021-05-02
 * @param   name          //用户名
 * @param   pwd           //密码
 * @returns 
 */
export function login(param) {
  return request({
    url: '/admin-user/login',
    method: 'post',
    data: {
      name: param.name,
      pwd: param.pwd
    }
  })
}

/**
 * 
 * @param  role   0普通1取件2管理员3快递中心取件员
 * @param  nick_name 用户名
 * @param  page 第几页
 * @param  pageSize  页容
 * @returns 
 */
export function aipGetUserList(param) {
  return request({
    url: '/member/list',
    method: 'GET',
    params: {
      role: param.role,
      nick_name: param.nick_name,
      page: param.page,
      pageSize: param.pageSize
    }
  })
}

/**
 * 
 * @param {身份} role
 * @param {用户ID} id
 * @param {管理的快递站点} express_id
 * @returns 
 */
export function apiSetUser(param) {
  return request({
    url: '/member/set-mem-express',
    method: 'POST',
    data: {
      role: param.role,
      id: param.id,
      express_id: param.express_id
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-element-admin/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}
